import { createRouter, createWebHistory } from "vue-router";

const routes = [
  {
    path: "/login",
    name: "Login",
    component: () => import("@/views/login/index.vue"),
    meta: {
      title: "登录",
      hideInMenu: true,
      fullscreen: true,
    },
  },
  {
    path: "/",
    name: "Home",
    component: () => import("@/views/home/index.vue"),
    meta: {
      title: "首页",
      requiresAuth: true,
      hideInMenu: true,
    },
    redirect: "/dashboard",
    children: [
      {
        path: "dashboard",
        name: "Dashboard",
        component: () => import("@/views/dashboard/index.vue"),
        meta: {
          title: "控制台",
          icon: "DataBoard",
        },
      },
      {
        path: "system",
        name: "System",
        component: () => import("@/views/system/index.vue"),
        redirect: "/system/user",
        meta: {
          title: "系统管理",
          icon: "Setting",
        },
        children: [
          {
            path: "user",
            name: "SystemUser",
            component: () => import("@/views/system/user/index.vue"),
            meta: {
              title: "用户管理",
              icon: "User",
            },
          },
          {
            path: "role",
            name: "SystemRole",
            component: () => import("@/views/system/role/index.vue"),
            meta: {
              title: "角色管理",
              icon: "UserFilled",
            },
          },
          {
            path: "menu",
            name: "SystemMenu",
            component: () => import("@/views/system/menu/index.vue"),
            meta: {
              title: "菜单管理",
              icon: "Menu",
            },
          },
          {
            path: "dict",
            name: "SystemDict",
            component: () => import("@/views/system/dict/index.vue"),
            meta: {
              title: "字典管理",
              icon: "Collection",
            },
          },
          {
            path: "log",
            name: "SystemLog",
            component: () => import("@/views/system/log/index.vue"),
            meta: {
              title: "系统日志",
              icon: "Document",
            },
          },
          {
            path: "config",
            name: "SystemConfig",
            component: () => import("@/views/system/config/index.vue"),
            meta: {
              title: "系统配置",
              icon: "Tools",
            },
          },
          {
            path: "notice",
            name: "SystemNotice",
            component: () => import("@/views/system/notice/index.vue"),
            meta: {
              title: "系统公告",
              icon: "Bell",
            },
          },
        ],
      },
      {
        path: "apps",
        name: "Apps",
        component: () => import("@/views/system/index.vue"),
        meta: {
          title: "应用管理",
          icon: "Shop",
        },
        children: [
          {
            path: "list",
            name: "AppList",
            component: () => import("@/views/apps/index.vue"),
            meta: {
              title: "应用列表",
              icon: "List",
            },
          },
          {
            path: "manage/:id",
            name: "AppManage",
            component: () => import("@/views/apps/manage.vue"),
            meta: {
              title: "应用管理",
              hideInMenu: true,
            },
          },
          {
            path: "version/:id",
            name: "AppVersion",
            component: () => import("@/views/apps/version.vue"),
            meta: {
              title: "版本管理",
              hideInMenu: true,
            },
          },
          {
            path: "settings/:id",
            name: "AppSettings",
            component: () => import("@/views/apps/settings.vue"),
            meta: {
              title: "应用设置",
              hideInMenu: true,
            },
          },
        ],
      },
      {
        path: "oa",
        name: "Oa",
        component: () => import("@/views/oa/index.vue"),
        meta: {
          title: "oa管理",
          icon: "Shop",
        },
        children: [
          {
            path: "list",
            name: "AppList",
            component: () => import("@/views/oa/index.vue"),
            meta: {
              title: "应用列表",
              icon: "List",
            },
          },
          {
            path: "flow-design",
            name: "flow-design",
            component: () => import("@/views/oa/flow-design.vue"),
            meta: {
              title: "oa设计",
              icon: "List",
              hideInMenu: true,
            },
          },
          {
            path: "manage/:id",
            name: "AppManage",
            component: () => import("@/views/apps/manage.vue"),
            meta: {
              title: "应用管理",
              hideInMenu: true,
            },
          },
          {
            path: "version/:id",
            name: "AppVersion",
            component: () => import("@/views/apps/version.vue"),
            meta: {
              title: "版本管理",
              hideInMenu: true,
            },
          },
          {
            path: "settings/:id",
            name: "AppSettings",
            component: () => import("@/views/apps/settings.vue"),
            meta: {
              title: "应用设置",
              hideInMenu: true,
            },
          },
        ],
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
